import { useModel } from "umi";

const Index = () => {
  const { masterState } = useModel("@@qiankunStateFromMaster");

  const handleClick = () => {
    window.postMessage({
      type: "childInfo",
      msg: "子应用发送了一条信息",
    });
  };
  return (
    <div>
      <h1>页面一</h1>
      <h1>使用useModel接收主应用数据：{masterState.version}</h1>
      <h1>子应用通过postMessage向应用发送信息</h1>
      <button onClick={handleClick}>发送数据</button>
    </div>
  );
};

export default Index;
